package org.tong.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.tong.service.MyAsyncService;

@RestController
public class AsyncController {

    @Autowired
    private MyAsyncService myAsyncService;

    @GetMapping("/async")
    public String startAsyncTask() {
        System.out.println(Thread.currentThread().getId() + " in controller");
        myAsyncService.startAsyncTask("小红");
        return "success";
    }
}
